﻿using System;

using Microsoft.Practices.EnterpriseLibrary.Logging;

namespace WcfCore
{
	public static class WcfLogger
	{
		public static void LogException(Exception exc)
		{
			string log = exc.ToString();
			Exception inner = exc.InnerException;
			while (inner != null)
			{
				log += inner.ToString();
				inner = inner.InnerException;
			}
			WcfLogger.Log(exc.ToString());
		}

		public static void Log(string log)
		{
			Console.WriteLine(log);
			LogEntry entry = new LogEntry();
			entry.TimeStamp = DateTime.Now;
			entry.Message = log;
			Logger.Write(entry);
		}
	}
}
